package com.promis.party.ui.partywork.dailywork.documentfile;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.promis.compat.StatusBarCompat;
import com.promis.party.R;
import com.promis.party.helper.UIHepler;
import com.promis.widget.recycler.RecyclerLayoutManagerHelper;

public class DocumentListActivity extends AppCompatActivity {
    private TextView txtvTitle;
    private RecyclerView rylvContainer08;
    private RecyclerView rylvContainer09;
    private DocumentListAdapter adaptDocument;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_document_list);
        StatusBarCompat.translucentStatusBar(this);
        StatusBarCompat.blackTextStatusBar(this);
        UIHepler.goBack(this, R.id.layout_top_title_imgv_close);
        txtvTitle = findViewById(R.id.layout_top_title_txtv_title);
        rylvContainer08 = findViewById(R.id.activity_document_list_rycv_container08);
        rylvContainer09 = findViewById(R.id.activity_document_list_rycv_container09);
        initData();
        initListener();
    }

    private void initData(){
        txtvTitle.setText("公文归档");
        adaptDocument = new DocumentListAdapter(getBaseContext());
        RecyclerLayoutManagerHelper.buildVerticalLinearLayoutManager(getBaseContext(),rylvContainer08);
        rylvContainer08.setAdapter(adaptDocument);
        RecyclerLayoutManagerHelper.buildVerticalLinearLayoutManager(getBaseContext(),rylvContainer09);
        rylvContainer09.setAdapter(adaptDocument);
    }

    private void initListener(){
        adaptDocument.setOnItemClickListener(new DocumentListAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View v, int position) {
                Intent intent = new Intent(getBaseContext(), DocumentDetailActivity.class);
                startActivity(intent);
            }
        });
    }
}
